cmake_minimum_required(VERSION 3.15)
project(test_package LANGUAGES C)

find_package(Qhull REQUIRED CONFIG)

if(QHULL_REENTRANT)
    add_executable(${PROJECT_NAME} test_package_r.c)
    if(TARGET Qhull::qhull_r)
        target_link_libraries(${PROJECT_NAME} PRIVATE Qhull::qhull_r)
    else()
        target_link_libraries(${PROJECT_NAME} PRIVATE Qhull::qhullstatic_r)
    endif()
else()
    add_executable(${PROJECT_NAME} test_package.c)
    if(TARGET Qhull::libqhull)
        target_link_libraries(${PROJECT_NAME} PRIVATE Qhull::libqhull)
    else()
        target_link_libraries(${PROJECT_NAME} PRIVATE Qhull::qhullstatic)
    endif()
endif()
